<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>原因</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/admin.css">
</head>
<body style="padding:10px;">
    <div class="layui-form">
        <input type="hidden" name="id_arr" value="{$id_arr}">
        <div class="layui-form-mid layui-word-aux">
            将ID为<span class="layui-badge">{$id_arr}</span>的文章的状态改为不通过，并添加不通过原因作为记录。
        </div>
        <div class="layui-form-item">
            <input type="text" name="no_pass_reason" lay-verify="required" placeholder="请输入原因" class="layui-input">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit lay-filter="go">确定</button>
        </div>
    </div>
</body>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['jquery','form'],function(){
        var $ = layui.jquery,
            form = layui.form;
        form.on("submit(go)",function(data){
            var post = {};
            post.id_arr = data.field.id_arr;
            post.no_pass_reason = data.field.no_pass_reason;
            $.ajax({
                url:"{:U('Admin/Article/nopass')}",
                data:post,
                type:"POST",
                dataType:'json',
                success:function(data){
                    if( data.status != 1 ){
                        layer.msg(data.msg,{icon:5});
                        return false;
                    }
                    var index = parent.layer.getFrameIndex(window.name);
                    layer.msg(data.msg,{icon:6});
                    setTimeout(function(){
                        parent.location.reload()
                        parent.layer.close(index);
                    },1000);
                },
                error:function(){
                    var index = parent.layer.getFrameIndex(window.name);
                    layer.msg("ERROR",{icon:5});
                    setTimeout(function(){
                        parent.location.reload()
                        parent.layer.close(index);
                    },1000);
                }
            });
        });
    });
</script>
</html>